using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

namespace RichFrame
{
    /// <summary>
    /// 默认的资源提供器，从resources加载
    /// </summary>
    public class DefaultAssetProvider : AssetsManager.IAssetProvider
    {
        public T LoadAsset<T>(string assetPath) where T : Object
        {
            return Resources.Load<T>(assetPath);
        }

        public AssetRequest LoadAssetAsync<T>(string assetPath) where T : Object
        {
            ResourceRequest request = Resources.LoadAsync<T>(assetPath);
            AssetRequest assetRequest = new AssetRequest(request, () => request.asset,()=>request.isDone, () => request.progress);
            return assetRequest;
        }
    }
}
